package com.yingside.collection.generic;

public class Student extends Person implements Comparable<Student>{
    private int id;
    private String name;
    private String tel;

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getTel() {
        return tel;
    }

    public void setTel(String tel) {
        this.tel = tel;
    }

    public Student() {
    }

    public Student(int id, String name, String tel) {
        this.id = id;
        this.name = name;
        this.tel = tel;
    }

    @Override
    public String toString() {
        return "Student{" +
                "id=" + id +
                ", name='" + name + '\'' +
                ", tel='" + tel + '\'' +
                '}';
    }

    @Override
    public int compareTo(Student student) {
        /*if(this.getId() < student.getId()){
            return -1;
        }
        else if(this.getId() > student.getId()){
            return 1;
        }
        else{
            return 0;
        }*/

        return this.getId() - student.getId();
    }
}
